<template>
  <div class="home">
    <div>
      {{ $store.state.num }}
    </div>
    <div>
      <button @click="add">点击</button>
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    add() {
      //点击按钮需要触发mutation
      this.$store.commit("updateNum", 1);
    },
  },
};
</script>
<style scoped>
</style>
